package cn.itcast.bos.web.action.base;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import cn.itcast.bos.domain.base.Courier;
import cn.itcast.bos.service.base.CourierService;

@Controller
@Scope("prototype")
@ParentPackage("json-default")
@Namespace("/")
@Actions
public class CourierAction extends ActionSupport implements ModelDriven<Courier>{
	
	private Courier courier=new Courier();
	@Override
	public Courier getModel() {
		
		return courier;
	}
	
	//注入service
	private CourierService courierService;
	//添加快递员的方法
	@Action(value="courier_save",results={@Result(name="success",location="./pages/base/courier.html",type="redirect")})
	public String save(){
		courierService.save(courier);
		
		return SUCCESS;
	}
}
